<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>采购询价报价清单</title>
	<link href="/res/css/respective/priceAsk/buyer.css" rel="stylesheet">
    <script src="/res/js/common/jquery.1.9.1.min.js"></script>
</head>
<body>
[#assign  menucode ="myProject"]
	<div class="warp">
		[#include "/front/common/front_headAzt.html"]
		<div class="backcontent">
			[#include "/front/common/front_leftAzt.html"]
			<div class="back-main">
				<div class="mainContent">
					<div class="mainContentWhite">
						<h1>报价清单</h1>
						<label class="opDetail" style="text-align: right; float: right;"> <a
							href="/enquiry/purchase/quote/detail/${enq.id}">返回询价单</a></label>
						<hr>
							<h2>基本信息</h2>
							<div class="baseInfo">
								<div>
									<dfn>
										项目名称：<span>${enq.enqProject.projectName!}</span>
									</dfn>
									<dfn>
										质保要求：<span>[#if enq.quality?? ]${enq.quality}年[#else]${enq.guaranteeinfo!} [/#if]</span>
									</dfn>
								</div>
								<div>
									<dfn>
										供应商：<span>${quote.companyName!}</span>
									</dfn>
									<dfn>
										报价人员：<span>${quoteman!}</span>
									</dfn>
								</div>
								<div>
									<dfn>
										报价时间：<span>${quote.quoteDate?string("yyyy-MM-dd")}</span>
									</dfn>
									<dfn>
										联系电话：<span>${quote.phone!}</span>
									</dfn>
								</div>
								<div>
									<dfn>
										报价含税：<span>[#if enq.taxPrice==3 ]不含[#else]含税${enq.taxInstro!}%[/#if]  </span>
									</dfn>
									<dfn>
										是否含运费：<span>${(enq.shipPrice==1)?string("含运费","不含运费")}</span>
									</dfn>
								</div>
								<div>
									<dfn>
										支付方式：<span>${enq.paymentStr!}</span>
									</dfn>
								</div>
							</div>
							<h2>报价清单
                                <div class="tableRight" style="margin-top: auto;">
                                    产品类目：
                                    <div class="ppSelect" style="display: inline-block; background: url(/res/images/checkBoxRadio/blueSelect_03.jpg) right center no-repeat; height: 20px;">
                                        <select id="allcats" style="height: 100%; border: none;background: none;">
                                            <option value="0">所有类目</option>
										[#list encats as cat ]
                                            <option value="${cat.categoryId}">${cat.categorName}</option>
										[/#list]
                                        </select>
                                    </div>
                                </div>
							</h2>
							<table class="table noBorder">
                            <thead>
                            <tr>
                                <th><input style="margin-right: 4px;" id="checkall" type="checkbox"/>全选</th>
                                <th>产品类目  </th>
                                <th width="20%">商品名称</th>
                                <th>品牌 </th>
                                <th>型号 </th>
                                <th>数量 </th>
                                <th>单位</th>
                                <th>单价</th>
								<th>技术参数</th>
                                <th>小计</th>
                            </tr>
                            </thead>
                            <tbody>

                            [#list  items as item ]
                                <tr class="q_tr q_tr_${item.categorySId!}" >
                                    <td><input   class="quotec"   type="checkbox" value="${item.id}"   /></td>
                                    [#--<td><a class="bugetTypeIcon" style="margin-right:20px;margin-left: 0px;">集</a>Mark</td>--]
                                    <td>${item.categoryName!}</td>
                                    <td><dfn title="${item.productName}" style="display: inline-block;width: 100%;overflow: hidden;height: 40px;">${item.productName}</dfn></td>
                                    <td>${item.brand!}</td>
                                    <td>${item.model!}</td>
                                    <td id="quantity_${item.id}" >${item.quantity!}</td>
                                    <td>${item.unit!}</td>
                                    <td>${item.unitprice!?string("currency")}</td>
                                    <td>${item.descr!}</td>
                                    <td class="contentBold">${item.totalPrice!?string("currency")}</td>
                                </tr>
                            [/#list]



                            </tbody>
                           <tfoot>

                            </tfoot>
                        </table>
						<div style="padding-left: 15px;height: 45px;margin-top: 30px;">
	                        <button  onclick="downquote(${quote.id})" type="button" class="backButt">下载完整清单</button>
							[#if enq.userId == userid  && enq.state==1 ]
	                        <button  onclick="gobuy(${enq.id},${quote.id})"  class="buyButt" style="height: 35px">购买商品</button>
							[/#if]
	                        [#--<button class="backButt" style="float: right;">加入对比</button>--]
	                    </div>
					</div>
				</div>
			</div>
			<!-- 底部菜单-->
			[#include "/front/common/front_footerAzt.html"]
		</div>

	</div>

	<script src="/res/js/common/common.js"></script>
    <script src="/res/third/layer/layer.js"></script>
    <script src="/res/third/layer/layer.extends.js"></script>
	<script type="text/javascript">


    function go(id,type){
        window.location.href= "/enquiry/project/detail/p/"+id+"/t/"+type;
    }


    /*发布采购询价*/
    function createpurchase() {
        location.href="/enquiry/purchase/choose";
    }

    //切换类别
    $("#allcats").on("change",function () {
        var trobj = $(this);
        var v= trobj.val();
		if(v==0){
            $(".q_tr").show();
		}else{
            $(".q_tr").hide();
            $(".q_tr_"+v).show();
		}
    });

    /*全选*/
    $("#checkall").click(function () {
        var obj = $(this);
        $(".quotec").each(function () {
            $(this)[0].checked=obj.is(":checked");
        })
    });


	function gobuy(enquiryid,quoteid) {
        var ids =[];
        $(".quotec:checked").each(function () {
            ids.push($(this).val());
        });
        if(ids.length==0){
            layer.msgShort("至少选择一个商品购买!")
			return false;
        }

		var d = [];
		var o ={};
		o.quoteId = quoteid;
		o.items=[];
		ids.forEach(function (id) {
            var oc ={};
			var quantity = $("#quantity_"+id).text();
			oc.itemId =id;
			oc.quantity =quantity;
			o.items.push(oc);
        });
		d.push(o);
		//
		$.my.postForm("/order/submit/quote",{enquiryId:enquiryid,item:JSON.stringify(d)});
    }
    function downquote(quoteid) {
        location.href = "/enquiry/quote/download/" + quoteid;
    }
	</script>
</body>
</html>
